package org.example.Mapper;

import org.apache.ibatis.annotations.*;
import org.example.Pojo.Depth;
import java.util.List;

@Mapper
public interface DepthMapper {

    /*
    * 从数据库中进行读取数据
    * */
    @Select("select id, name, create_time, update_time from dept")
    public List<Depth> findAll();

    /*
    * 删除通过Id
    * */
    @Delete("DELETE from dept where id=#{id}")
    void deleteById(Integer id);

    /*
    * 添加部门名字
    * */
    @Insert("insert into dept(name,create_time,update_time) values(#{name},#{createTime},#{updateTime})")
    void insert(Depth depth);


    /*
    * 查找通过Id
    * */
    @Select("select id, name, create_time createTime, update_time updateTime from dept where id=#{id}")
    Depth findById(Integer id);

    /*
    * 修改部门通过ID
    * */
    @Update("update dept set name=#{name} where id=#{id}")
    void updateById(Depth depth);
}
